// 深拷贝
let deepClone = function(source) {
    return Array.isArray(source)
        ? source.map((item) => deepClone(item))
        : source instanceof Date
        ? new Date(source.getTime())
        : source && typeof source === 'object'
        ? Object.getOwnPropertyNames(source).reduce((o, prop) => {
            Object.defineProperty(
            o,
            prop,
            Object.getOwnPropertyDescriptor(source, prop)
            );
            o[prop] = deepClone((source)[prop]);
            return o;
        }, Object.create(Object.getPrototypeOf(source)))
        : source;
}

exports.deepClone = deepClone